function getUserInfo(authCode){
  // 请求后端用户信息接口，获取用户信息
  let promise = new Promise(function(success, fail){
    dd.httpRequest({
      headers: {
        "Content-Type": "application/json"
      },
      url: 'http://123.249.125.89/api/userinfo',
      method: 'POST',
      // 需要手动调用JSON.stringify将数据进行序列化
      data: JSON.stringify({
        authCode: authCode
      }),
      dataType: 'json',
      success: function(res) {
        if(res.data.code==0){
          console.log("获取用户信息成功", res);
          success(res.data.data);
        }else{
          console.log("获取用户信息失败", res);
          success(null);
        }
        
      },
      fail: function(res) {
        // dd.alert({content: 'fail'});
        fail(res)
      },
      complete: function(res) {
        // dd.alert({request_user_info: 'complete'});
      }
    });
  });
  return promise;
  
}

module.exports = {getUserInfo}
